{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Table of Contents\n",
    "- [About Guidance](#about-guidance)\n",
    "- [Setup](#setup)\n",
    "- [Unconstrained Generation](#unconstrained-generation)\n",
    "- [Speaking for Phi 3](#speaking-for-phi-3)\n",
    "- [Regex](#constraining-with-regex)\n",
    "- [Select](#selecting-from-multiple-choices)\n",
    "- [Chain of Thought](#chain-of-thought)\n",
    "- [JSON Generation](#json-generation)\n",
    "- [HTML Generation](#html-generation)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# About Guidance\n",
    "Guidance is a proven open-source Python library for controlling outputs of any language model (LM). With one API call, you can express (in Python) the precise programmatic constraint(s) that the model must follow and generate the structured output in JSON, Python, HTML, SQL, or any structure that the use case requires.\n",
    "\n",
    "Guidance differs from conventional prompting techniques.  It enforces constraints by steering the model token by token in the inference layer, producing higher quality outputs and reducing cost and latency by as much as 30–50% when utilizing for highly structured scenarios.\n",
    "\n",
    "To learn more about Guidance, visit the [public repository on GitHub](https://github.com/guidance-ai/guidance) or watch the Guidance Breakout Session at Microsoft Build."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Setup\n",
    "1. Install Guidance with `pip install guidance --pre`\n",
    "2. Deploy a Phi 3.5 mini endpoint in Azure by going to https://ai.azure.com/explore/models/Phi-3.5-mini-instruct/version/2/registry/azureml and clicking the \"Deploy\" button\n",
    "3. Store your endpoint's API key in an environment variable called `AZURE_PHI3_KEY` and the URL in an environment variable called `AZURE_PHI3_URL`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from guidance import gen, select, regex, user, assistant, system, json\n",
    "from guidance.models import AzureGuidance\n",
    "from json import loads as load_json_str\n",
    "import os\n",
    "\n",
    "phi3_url = os.getenv(\"AZURE_PHI3_URL\")\n",
    "phi3_api_key = os.getenv(\"AZURE_PHI3_KEY\")\n",
    "phi3_lm = AzureGuidance(f\"{phi3_url}/guidance#auth={phi3_api_key}\")\n",
    "\n",
    "# Or, load from HuggingFace to run locally\n",
    "# from guidance.models import Transformers\n",
    "# phi3_lm = Transformers(\"microsoft/Phi-3-mini-4k-instruct\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Unconstrained generation\n",
    "Text can be generated without any constraints using the `gen()` function. This is the same as using the model without Guidance.\n",
    "\n",
    "## Chat Formatting\n",
    "Like many chat models, Phi-3 expects messages between a user and assistant in a specific format. Guidance supports Phi-3's chat template and will manage chat formatting for you. To create chat turns, put each portion of the conversation in a `with user()` or `with assistant()` block. A `with system()` block can be used to set the system message."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style='margin: 0px; padding: 0px; vertical-align: middle; padding-left: 8px; margin-left: -8px; border-radius: 0px; border-left: 1px solid rgba(127, 127, 127, 0.2); white-space: pre-wrap; font-family: ColfaxAI, Arial; font-size: 15px; line-height: 23px;'><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>system</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'>You are a helpful assistant. You have a cranky yet entertaining temperament.</div></div><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>user</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'>What is the capital of Australia?</div></div><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>assistant</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> The</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> capital</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Australia</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> is</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Can</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ber</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ra</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> It</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&#x27;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>s</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> fun</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ny</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> how</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> most</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> people</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> think</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> it</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&#x27;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>s</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Sydney</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> or</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Melbourne</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> isn</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&#x27;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>t</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> it</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>?</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> But</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> he</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>y</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> don</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&#x27;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>t</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> cry</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> for</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> spo</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>iled</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> tour</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ists</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> -</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> we</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> all</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> know</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> real</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> sc</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>oop</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>!</span></div></div></pre>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "lm = phi3_lm\n",
    "with system():\n",
    "    lm += \"You are a helpful assistant. You have a cranky yet entertaining temperament.\"\n",
    "with user():\n",
    "    lm += \"What is the capital of Australia?\"\n",
    "with assistant():\n",
    "    lm += gen(temperature=0.8, max_tokens=100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Token savings\n",
    "In highly structured scenarios, Guidance can skip tokens and generate only necessary tokens, improving performance, increasing efficiency and saving API costs. Generated tokens are shown in this notebook with a highlighted background. Forced tokens are shown without highlighting and cost the same as input tokens, which are estimated at one third the cost of output tokens.\n",
    "\n",
    "*Note:* The first example with unconstrained generation was not able to force any tokens because we provided no constraints."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Speaking for Phi 3 \n",
    "With Guidance, you can easily inject text into the model's responses. This can be helpful if you want to guide the model's output in a specific direction."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style='margin: 0px; padding: 0px; vertical-align: middle; padding-left: 8px; margin-left: -8px; border-radius: 0px; border-left: 1px solid rgba(127, 127, 127, 0.2); white-space: pre-wrap; font-family: ColfaxAI, Arial; font-size: 15px; line-height: 23px;'><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>user</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'>What is the capital of Australia?</div></div><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>assistant</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'>The capital of Australia is<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Can</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ber</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ra</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> It</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> is</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> not</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Sydney</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> or</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Melbourne</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> cities</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> most</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> commonly</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> associated</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> with</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Australia</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> but</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> rather</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Can</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ber</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ra</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> The</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> capital</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> was</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> selected</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> as</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> comprom</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ise</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> between</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> riv</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>als</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Sydney</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Melbourne</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Australia</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&#x27;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>s</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> two</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> largest</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> cities</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Can</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ber</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ra</span></div></div></pre>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "lm = phi3_lm\n",
    "with user():\n",
    "    lm += \"What is the capital of Australia?\"\n",
    "with assistant():\n",
    "    lm += \"The capital of Australia is \" + gen(temperature=0.8, max_tokens=50)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`The capital of Australia is` is not highlighted because that portion of the assistant's response was forced by Guidance."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Constraining with regex\n",
    "In the previous example, Phi 3 responded with follow-up explanations after answering the question with `Canberra`. In order to constrain the model's output to exactly one word, a regex can be used."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style='margin: 0px; padding: 0px; vertical-align: middle; padding-left: 8px; margin-left: -8px; border-radius: 0px; border-left: 1px solid rgba(127, 127, 127, 0.2); white-space: pre-wrap; font-family: ColfaxAI, Arial; font-size: 15px; line-height: 23px;'><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>user</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'>What is the capital of Australia?</div></div><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>assistant</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'>The capital of Australia is<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Can</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ber</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ra</span></div></div></pre>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "lm = phi3_lm\n",
    "with user():\n",
    "    lm += \"What is the capital of Australia?\"\n",
    "with assistant():\n",
    "    lm += \"The capital of Australia is \" + regex(\"[A-Z][a-z]+\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "With the regex, only the word `Canberra` is generated."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Selecting from multiple choices\n",
    "When some possible choices are known, you can use the `select()` function to have the model choose from a list of options."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style='margin: 0px; padding: 0px; vertical-align: middle; padding-left: 8px; margin-left: -8px; border-radius: 0px; border-left: 1px solid rgba(127, 127, 127, 0.2); white-space: pre-wrap; font-family: ColfaxAI, Arial; font-size: 15px; line-height: 23px;'><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>user</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'>What is the capital of Australia?</div></div><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>assistant</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'>The capital of Australia is<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Can</span>berra</div></div></pre>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "lm = phi3_lm\n",
    "with user():\n",
    "    lm += \"What is the capital of Australia?\"\n",
    "with assistant():\n",
    "    lm += \"The capital of Australia is \" + select([\"Washington\", \"Canberra\", \"Sydney\", \"Melbourne\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "With `select()`, only the token `Can` was generated. Because `Canberra` is the only option that can possibly complete the response, the remaining tokens were forced."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chain of Thought\n",
    "Chain of thought is a technique that can help improve the quality of the model's output by encouraging it to process a problem step by step. Typically, to reach a final answer, multiple prompt turns are necessary. First, instruct the model to think step by step. Then, the prompt the model again to provide the final answer. With standard chat inference APIs, this takes 2 API calls, and the model’s generated “chain of thought” gets charged twice – once as output tokens when the model generated it, and then again as input tokens for the second call. With Guidance,  the entire multi-step process is processed and charged as part of a single API call, reducing cost and latency."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style='margin: 0px; padding: 0px; vertical-align: middle; padding-left: 8px; margin-left: -8px; border-radius: 0px; border-left: 1px solid rgba(127, 127, 127, 0.2); white-space: pre-wrap; font-family: ColfaxAI, Arial; font-size: 15px; line-height: 23px;'><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>user</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'>Mark has a garden with flowers. He planted plants of three different colors in it. Ten of them are yellow, and there are 80% more of those in purple. There are only 25% as many green flowers as there are yellow and purple flowers. How many flowers does Mark have in his garden?</div></div><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>assistant</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'>Let&#x27;s think step by step.<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> First</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> we</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> need</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> determine</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> number</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> pur</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ple</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Mark</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> has</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> We</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> know</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> there</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> are</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>8</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>0</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>%</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> more</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> pur</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ple</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> than</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> yellow</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>To</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> find</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>8</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>0</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>%</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> yellow</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> we</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> calculate</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>:</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>8</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>0</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>%</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>1</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>0</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> yellow</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> =</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>0</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>8</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>0</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> *</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>1</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>0</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> =</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>8</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>So</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> there</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> are</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>8</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> more</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> pur</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ple</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> than</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> yellow</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Since</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> there</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> are</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>1</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>0</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> yellow</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> number</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> pur</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ple</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> is</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>:</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>1</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>0</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> yellow</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> +</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>8</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> more</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> pur</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ple</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> =</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>1</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>8</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> pur</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ple</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>Next</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> we</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> need</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> find</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> out</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> how</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> many</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> green</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> there</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> are</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> The</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> problem</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> states</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> there</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> are</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> only</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>2</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>5</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>%</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> as</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> many</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> green</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> as</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> there</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> are</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> yellow</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> pur</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ple</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> combined</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>First</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> let</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&#x27;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>s</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> find</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> total</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> number</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> yellow</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> pur</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ple</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>:</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>1</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>0</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> yellow</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> +</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>1</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>8</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> pur</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ple</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> =</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>2</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>8</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>Now</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> calculate</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>2</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>5</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>%</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> this</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> total</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> find</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> number</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> green</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>:</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>2</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>5</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>%</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>2</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>8</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> =</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>0</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>2</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>5</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> *</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>2</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>8</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> =</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>7</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> green</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>Fin</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ally</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> find</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> total</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> number</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> in</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Mark</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&#x27;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>s</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> garden</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> we</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> add</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> yellow</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> pur</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ple</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> green</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> together</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>:</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>1</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>0</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> yellow</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> +</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>1</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>8</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> pur</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ple</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> +</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>7</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> green</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> =</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>3</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>5</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>There</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>fore</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Mark</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> has</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> total</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>3</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>5</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> flowers</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> in</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> his</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> garden</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>The</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> answer</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> is</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>:</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>3</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>5</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>\n",
       "</span>\n",
       "Therefore, the final answer is: <span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>3</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>5</span></div></div></pre>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Final answer: 35\n"
     ]
    }
   ],
   "source": [
    "gsm8k_question = \"Mark has a garden with flowers. He planted plants of three different colors in it. Ten of them are yellow, and there are 80% more of those in purple. There are only 25% as many green flowers as there are yellow and purple flowers. How many flowers does Mark have in his garden?\"\n",
    "lm = phi3_lm\n",
    "with user():\n",
    "    lm += gsm8k_question\n",
    "with assistant():\n",
    "    lm += \"Let's think step by step. \" + gen(temperature=0.8, max_tokens=500)\n",
    "    # Prompt for the final answer, which should be a number. Store the output in an \"answer\" variable.\n",
    "    lm += \"\\nTherefore, the final answer is: \" + regex(r\"\\d+\", name=\"answer\")\n",
    "\n",
    "print(f\"Final answer: {lm['answer']}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# JSON Generation\n",
    "Guidance can be used to guarantee generation of JSON compliant with a JSON schema or pydantic model, such as the user profile schema shown here."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style='margin: 0px; padding: 0px; vertical-align: middle; padding-left: 8px; margin-left: -8px; border-radius: 0px; border-left: 1px solid rgba(127, 127, 127, 0.2); white-space: pre-wrap; font-family: ColfaxAI, Arial; font-size: 15px; line-height: 23px;'><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>user</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'>Generate a JSON object for a user profile. The profile should include a username, age, email, and nothing more.</div></div><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>assistant</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>{&quot;</span>username<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&quot;:</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> &quot;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>John</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>Do</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>e</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&quot;,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> &quot;</span>age<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&quot;:</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> </span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>2</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>9</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> &quot;</span>email<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&quot;:</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> &quot;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>j</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ohn</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>do</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>e</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>@</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>example</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>com</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&quot;}</span></div></div></pre>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "user_json_schema = load_json_str(\"\"\"{\n",
    "  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n",
    "  \"title\": \"User Profile\",\n",
    "  \"type\": \"object\",\n",
    "  \"properties\": {\n",
    "    \"username\": {\n",
    "      \"type\": \"string\"\n",
    "    },\n",
    "    \"age\": {\n",
    "      \"type\": \"integer\"\n",
    "    },\n",
    "    \"email\": {\n",
    "      \"type\": \"string\"\n",
    "    }\n",
    "  },\n",
    "  \"additionalProperties\": false\n",
    "}\n",
    "\"\"\")\n",
    "\n",
    "lm = phi3_lm\n",
    "with user():\n",
    "    lm += \"Generate a JSON object for a user profile. The profile should include a username, age, email, and nothing more.\"\n",
    "\n",
    "with assistant():\n",
    "    lm += json(schema=user_json_schema, temperature=1.0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style='margin: 0px; padding: 0px; vertical-align: middle; padding-left: 8px; margin-left: -8px; border-radius: 0px; border-left: 1px solid rgba(127, 127, 127, 0.2); white-space: pre-wrap; font-family: ColfaxAI, Arial; font-size: 15px; line-height: 23px;'><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>user</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'>Generate a JSON object for a user profile. The profile should include a username, age, email, and nothing more.</div></div><div style='display: flex; border-bottom: 1px solid rgba(127, 127, 127, 0.2);  justify-content: center; align-items: center;'><div style='flex: 0 0 80px; opacity: 0.5;'>assistant</div><div style='flex-grow: 1; padding: 5px; padding-top: 10px; padding-bottom: 10px; margin-top: 0px; white-space: pre-wrap; margin-bottom: 0px;'><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>{&quot;</span>username<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&quot;:&quot;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>tech</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>_</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>g</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>uru</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&quot;,&quot;</span>age<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&quot;:</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>4</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>5</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,&quot;</span>email<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&quot;:&quot;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>tech</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>for</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>life</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>@</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>example</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>com</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&quot;}</span></div></div></pre>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from pydantic import BaseModel\n",
    "\n",
    "class UserProfile(BaseModel):\n",
    "    username: str\n",
    "    age: int\n",
    "    email: str\n",
    "\n",
    "\n",
    "lm = phi3_lm\n",
    "with user():\n",
    "    lm += \"Generate a JSON object for a user profile. The profile should include a username, age, email, and nothing more.\"\n",
    "\n",
    "with assistant():\n",
    "    lm += json(schema=UserProfile, temperature=1.0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## HTML Generation\n",
    "\n",
    "Guidance can also be used to generate code and follow the syntactical requirements in the programming language. In this section, we will create a small Guidance program for writing very simple HTML webpages.\n",
    "\n",
    "We will break the webpage down into smaller sections, each with its own Guidance function.  These are then combined in our final function to create an HTML webpage.\n",
    "We will then run this function against a Guidance-enabled model in Azure AI.\n",
    "\n",
    "*Note:* This is not going to be a fully-featured HTML generator; the goal is to show how you can create structured output for your individual needs\n",
    "\n",
    "We begin by importing what we require from Guidance:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from guidance import guidance\n",
    "from guidance.library import (\n",
    "    zero_or_more,\n",
    "    any_char_but,\n",
    "    select,\n",
    "    capture,\n",
    "    with_temperature,\n",
    ")\n",
    "from guidance.models import Model"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "HTML webpages are highly structured, and we will 'force' those parts of the page using Guidance.\n",
    "When we explicitly require text from the model, we need to ensure it doesn't include anything which could be a tag - that is, we must exclude the '<' and '>' characters:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "@guidance(stateless=True)\n",
    "def _gen_text(lm: Model):\n",
    "    return lm + zero_or_more(any_char_but([\"<\", \">\"]))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can then use this function to generate text within an arbitrary HTML tag:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "@guidance(stateless=True)\n",
    "def _gen_text_in_tag(lm: Model, tag: str):\n",
    "    lm += f\"<{tag}>\"\n",
    "    lm += _gen_text()\n",
    "    lm += f\"</{tag}>\"\n",
    "    return lm"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now, let us create the page header.\n",
    "As part of this, we need to generate a page title:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "@guidance(stateless=True)\n",
    "def _gen_header(lm: Model):\n",
    "    lm += \"<head>\\n\"\n",
    "    lm += _gen_text_in_tag(\"title\") + \"\\n\"\n",
    "    lm += \"</head>\\n\"\n",
    "    return lm"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The body of the HTML page is going to be filled with headings and paragraphs.\n",
    "We can define a function to do each:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "@guidance(stateless=True)\n",
    "def _gen_heading(lm: Model):\n",
    "    lm += select(\n",
    "        options=[_gen_text_in_tag(\"h1\"), _gen_text_in_tag(\"h2\"), _gen_text_in_tag(\"h3\")]\n",
    "    )\n",
    "    lm += \"\\n\"\n",
    "    return lm\n",
    "\n",
    "@guidance(stateless=True)\n",
    "def _gen_para(lm: Model):\n",
    "    lm += _gen_text_in_tag(\"p\")\n",
    "    lm += \"\\n\"\n",
    "    return lm"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now, the function to define the body of the HTML itself.\n",
    "This uses `select()` with `recurse=True` to generate multiple headings and paragraphs:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "@guidance(stateless=True)\n",
    "def _gen_body(lm: Model):\n",
    "    lm += \"<body>\\n\"\n",
    "    lm += select(options=[_gen_heading(), _gen_para()], recurse=True)\n",
    "    lm += \"</body>\\n\"\n",
    "    return lm"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Next, we come to the function which generates the complete HTML page.\n",
    "We add the HTML start tag, then generate the header, then body, and then append the ending HTML tag:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "@guidance(stateless=True)\n",
    "def _gen_html(lm: Model):\n",
    "    lm += \"<html>\\n\"\n",
    "    lm += _gen_header()\n",
    "    lm += _gen_body()\n",
    "    lm += \"</html>\\n\"\n",
    "    return lm"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We provide a user-friendly wrapper, which will allow us to:\n",
    "- Set the temperature of the generation\n",
    "- Capture the generated page from the Model object"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "@guidance(stateless=True)\n",
    "def html(\n",
    "    lm,\n",
    "    name: str | None = None,\n",
    "    *,\n",
    "    temperature: float = 0.0,\n",
    "):\n",
    "    return lm + capture(\n",
    "        with_temperature(_gen_html(), temperature=temperature),\n",
    "        name=name,\n",
    "    )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can provide a prompt to the model, and then request a generation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style='margin: 0px; padding: 0px; vertical-align: middle; padding-left: 8px; margin-left: -8px; border-radius: 0px; border-left: 1px solid rgba(127, 127, 127, 0.2); white-space: pre-wrap; font-family: ColfaxAI, Arial; font-size: 15px; line-height: 23px;'>Create a web page about your life story. Split your uplifting tale into multiple paragraphs with headings:\n",
       "&lt;html&gt;\n",
       "&lt;head&gt;\n",
       "&lt;title<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&gt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>My</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Life</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Story</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;/</span>title&gt;\n",
       "&lt;/head&gt;\n",
       "&lt;body&gt;\n",
       "&lt;<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>h</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>1</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&gt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>My</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Life</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Story</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;/</span>h1&gt;\n",
       "<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>p</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&gt;&lt;</span>/p&gt;\n",
       "<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>h</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>2</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&gt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>E</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ar</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ly</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Years</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;/</span>h2&gt;\n",
       "<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>p</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&gt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> was</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> born</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> raised</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> in</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> small</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> town</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> in</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Mid</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>west</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> From</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> young</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> age</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> was</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> fasc</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>in</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ated</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> by</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> world</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> around</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> me</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> had</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> natural</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> curiosity</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> that</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> drove</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> me</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> explore</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> learn</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Despite</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> challeng</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>es</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> growing</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> up</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> in</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> tight</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>-</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>kn</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>it</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> community</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> was</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> fort</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>un</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ate</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> support</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ive</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> family</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> strong</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> sense</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> community</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> that</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> helped</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> me</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> develop</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> res</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>il</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ient</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> optim</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>istic</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> out</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>look</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> on</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> life</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.&lt;/</span>p&gt;\n",
       "<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>h</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>2</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&gt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>E</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ducation</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Career</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;/</span>h2&gt;\n",
       "<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>p</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&gt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>After</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> gradu</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ating</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> from</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> high</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> school</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> purs</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ued</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> degree</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> in</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> engineering</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> at</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> pr</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>estig</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ious</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> university</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> was</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> passion</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ate</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> about</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> using</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> my</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> skills</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> make</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> positive</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> impact</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> on</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> world</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> worked</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> hard</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> excel</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> in</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> my</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> studies</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Upon</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> gradu</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ation</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> land</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ed</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> job</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> at</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> leading</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> te</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ch</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> company</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> where</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> quickly</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> rose</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> through</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> ranks</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> became</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> respect</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ed</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> leader</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> in</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> my</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> field</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.&lt;/</span>p&gt;\n",
       "<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>p</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&gt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>T</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>hr</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ough</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>out</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> my</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> career</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> been</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> driven</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> by</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> desire</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> innov</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ate</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> create</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> new</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> solutions</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> complex</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> problems</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> been</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> fort</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>un</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ate</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> work</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> on</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> variety</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> exc</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>iting</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> projects</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> from</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> developing</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> cutting</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>-</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>edge</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> software</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> design</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ing</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> sust</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ain</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>able</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> energy</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> systems</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> also</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> had</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> opportunity</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> travel</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> world</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> collabor</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ate</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> with</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> tal</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ented</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> individuals</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> from</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> diverse</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> background</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>s</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.&lt;/</span>p&gt;\n",
       "<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>h</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>2</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&gt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>Person</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>al</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> G</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>row</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>th</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> Ach</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>iev</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ements</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;/</span>h2&gt;\n",
       "<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>p</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&gt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>Out</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>side</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> work</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> always</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> been</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> committed</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> personal</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> growth</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> self</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>-</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>im</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>prov</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ement</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> taken</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> courses</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> in</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> med</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>itation</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> y</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>oga</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> mind</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ful</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ness</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> found</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> that</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> these</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> practices</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> helped</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> me</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> cultiv</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ate</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> sense</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> inner</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> peace</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> balance</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> also</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> been</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> an</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> av</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>id</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> runner</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> completed</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> several</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> mar</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ath</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ons</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> which</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> has</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> taught</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> me</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> importance</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> per</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>se</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ver</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ance</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> discipline</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.&lt;/</span>p&gt;\n",
       "<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>p</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&gt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>In</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> addition</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> my</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> professional</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> personal</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> purs</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>uits</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> also</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> been</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> involved</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> in</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> various</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> char</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>itable</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> organizations</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> volunte</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ered</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> my</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> time</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> help</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> those</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> in</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> need</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> believe</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> that</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> giving</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> back</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> community</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> is</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> an</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> essential</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> part</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> living</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> ful</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>fill</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ing</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> life</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> am</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> proud</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> made</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> positive</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> impact</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> in</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> lives</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> of</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> others</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.&lt;/</span>p&gt;\n",
       "<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>h</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>2</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&gt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>Con</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>clusion</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;/</span>h2&gt;\n",
       "<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>p</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&gt;</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>Look</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ing</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> back</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> on</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> my</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> life</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> am</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> grateful</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> for</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> all</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> experiences</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> opportun</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ities</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> that</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> sh</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>aped</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> me</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> into</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> person</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> am</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> today</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> faced</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> many</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> challeng</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>es</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> set</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>back</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>s</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> along</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> way</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> but</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> have</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> always</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> remained</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> optim</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>istic</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> focused</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> on</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> my</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> goals</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> am</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> excited</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> continue</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> growing</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> learning</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>,</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> I</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> am</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> committed</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> using</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> my</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> skills</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> and</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> tal</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>ents</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> to</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> make</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> a</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> positive</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> impact</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> on</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> the</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'> world</span><span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>.&lt;/</span>p&gt;\n",
       "<span style='background-color: rgba(165.0, 0.0, 0, 0.15); border-radius: 3px;' title='0.0'>&lt;/</span>body&gt;\n",
       "&lt;/html&gt;\n",
       "</pre>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "lm = phi3_lm\n",
    "\n",
    "lm += \"Create a web page about your life story. Split your uplifting tale into multiple paragraphs with headings:\\n\"\n",
    "lm += html(name=\"html_text\", temperature=0.7)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can then write the output to a file:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('./sample_page.html', 'w') as html_file:\n",
    "    html_file.write(lm[\"html_text\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "And [see the result](./sample_page.html)."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "env",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
